package com.oopnet.template.test;

import java.io.File;
import java.nio.file.Files;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.junit.Test;

public class FunctionalProgramming {
	@SuppressWarnings("unchecked")
	@Test
	public void testName() throws Exception {
//		new Thread(() -> System.out.println("Hello")).start();
//		System.out.println(LocalDate.now());
//		DateTimeFormatter df = DateTimeFormatter.ofPattern("yy/MM/dd");
//		System.out.println(df.format(LocalDate.now()));
////		System.out.println(LocalDate.parse("17/01/04",df));
//		Files.list(new File("/home/mercy/Documents/").toPath())
//	     .forEach(System.out::println);
		
		@SuppressWarnings("rawtypes")
		Stream stream = Stream.of("A","B","C",11);
		stream.filter(p->p.equals(11)).collect(Collectors.toCollection(ArrayList::new));;
		
		Stream<List<Integer>> inputStream = Stream.of(
				 Arrays.asList(1),
				 Arrays.asList(2, 3),
				 Arrays.asList(4, 5, 6)
				 );
				 inputStream.
				flatMap((childList) -> childList.stream()).forEach(System.out::print);;
		int sumValue = Stream.of(1, 2, 3, 4).reduce(0, Integer::sum);
		System.out.println(sumValue);
//		Optional.ofNullable("")
		
		System.out.println((3*0.1));
	}
}
